import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path"; //
import postCssPxToRem from "postcss-pxtorem";

// https://vitejs.dev/config/
export default defineConfig({
  base: "./",
  plugins: [vue()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
      },
    },
    postcss: {
      plugins: [
        postCssPxToRem({
          // 自适应，px>rem转换
          rootValue: 16,
          propList: ["*", "!border"], // 除 border 外所有px 转 rem
          selectorBlackList: ["norem"], // 过滤掉norem-  .el开头的class，不进行rem转换，这个内容可以不写
        }),
      ],
    },
  },
});
